package io.renren.modules.piclocalupload.controller;

import io.renren.common.utils.Result;
import io.renren.modules.piclocalupload.service.PicLocalUploadService;
import io.renren.modules.piclocalupload.vo.PictureInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 本地图片上传
 *
 * @author zhengweipeng sunlightcs@gmail.com
 * @since 1.0.0 2023-01-01
 */
@RestController
@RequestMapping("piclocal/upload")
@Api(tags="本地图片上传")
public class PicLocalUploadController {

    @Autowired
    private PicLocalUploadService picLocalUploadService;

    @PostMapping("pic")
    @ApiOperation("本地图片上传")
    public Result<PictureInfoVO> uploadPic(@RequestParam("file") MultipartFile uploadFile) {
        PictureInfoVO pictureInfoVo = picLocalUploadService.uploadPic(uploadFile);
        return new Result<PictureInfoVO>().ok(pictureInfoVo);
    }


}
